package edu.bu.grocerylist.service;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import edu.bu.grocerylist.model.GroceryList;
import edu.bu.grocerylist.model.GroceryUser;

/**
 * Sample implementation while waiting for grocery list DAO to be completed
 * @author donlanp
 *
 */
public class FakeGroceryListService extends GroceryListService{
	
	private List<GroceryList> fakeLists;
	
	public FakeGroceryListService(){
		fakeLists = new ArrayList<GroceryList>();
		
		for(int i= 0; i < 5; i++){
			GroceryList list = new GroceryList();
			list.setGroceryListId(i);
			list.setName("Test list #" + i);
			list.setShoppingDate(new Date());
			fakeLists.add(list);
			
		}
	}

	public List<GroceryList> getUsersGroceryList(GroceryUser user) {
		return fakeLists;
	}
	
	public GroceryList getGroceryListById(int id){
		for(GroceryList g : fakeLists){
			if(g.getGroceryListId() == id){
				return g;
			}
		}
		
		return null;
	}
	

}
